package algorithm.linkedList;

public class LinkReverse {

    //单链表反转
    //这个方法有OJ，在leetcode 单链表反转
    public static ListNode linkReverse(ListNode head){
        ListNode pre=null;
        ListNode next=null;
        while(head!=null){
            next=head.next;
            head.next=pre;
            pre=head;
            head=next;
        }
        return pre;
    }
}
